<article id="wikiArticle">
<div></div>
<p>逻辑运算符通常用于<a href="Reference/Boolean" title="此页面仍未被本地化, 期待您的翻译!"><code>布尔</code></a>型（逻辑）值。这种情况下，它们返回一个布尔值。然而，<code>&amp;&amp;</code> 和 <code>||</code> 运算符会返回一个指定操作数的值，因此，这些运算符也用于非布尔值。这时，它们也就会返回一个非布尔型值。</p>
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/expressions-logicaloperator.html" width="100%"></iframe></div>
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a class="external" href="https://github.com/mdn/interactive-examples" rel="noopener">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p>
<h2 id="描述">描述</h2>
<p>The logical operators are described in the following table (the <code><em>expr</em></code>essions may be of any <a href="/en-US/docs/Glossary/Data_structure">type</a>, not just boolean):</p>
<table class="fullwidth-table syntaxbox">
<tbody>
<tr>
<th>运算符</th>
<th>语法</th>
<th>说明</th>
</tr>
<tr>
<td>逻辑与，AND（<code>&amp;&amp;</code>）</td>
<td><code><em>expr1</em> &amp;&amp; <em>expr2</em></code></td>
<td>若 <code>expr<strong>1</strong></code> 可转换为 <code>true</code>，则返回 <code>expr<strong>2</strong></code>；否则，返回 <code>expr<strong>1</strong></code>。</td>
</tr>
<tr>
<td>逻辑或，OR（<code>||</code>）</td>
<td><code><em>expr1</em> || <em>expr2</em></code></td>
<td>若 <code>expr<strong>1</strong></code> 可转换为 <code>true</code>，则返回 <code>expr<strong>1</strong></code>；否则，返回 <code>expr<strong>2</strong></code>。</td>
</tr>
<tr>
<td>逻辑非，NOT（<code>!</code>）</td>
<td><code>!<em>expr</em></code></td>
<td>若 <code>expr</code> 可转换为 <code>true</code>，则返回 <code>false</code>；否则，返回 <code>true</code>。</td>
</tr>
</tbody>
</table>
<p>如果一个值可以被转换为 <code>true</code>，那么这个值就是所谓的 <a class="glossaryLink" href="/en-US/docs/Glossary/truthy" title='truthy: In JavaScript, a truthy value is a value that is considered  true when encountered in a Boolean context. All values are truthy unless they are defined as falsy (i.e., except for false, 0, "", null, undefined, and NaN).'>truthy</a>，如果可以被转换为 <code>false</code>，那么这个值就是所谓的 <a class="glossaryLink" href="/en-US/docs/Glossary/falsy" title="falsy: A falsy value is a value that is considered false when encountered in a Boolean context.">falsy</a>。</p>
<p>会被转换为 <code>false</code> 的表达式有：</p>
<ul>
<li><code>null</code>；</li>
<li><code>NaN</code>；</li>
<li><code>0</code>；</li>
<li>空字符串（<code>""</code> or <code>''</code> or <code>``</code>）；</li>
<li><code>undefined</code>。</li>
</ul>
<p>尽管 <code>&amp;&amp;</code> 和 <code>||</code> 运算符能够使用非布尔值的操作数, 但它们依然被看作是布尔操作符，因为它们的返回值总是能够被转换为布尔值。</p>
<p>Even though the <code>&amp;&amp;</code> and <code>||</code> operators can be used with operands that are not Boolean values, they can still be considered boolean operators since their return values can always be converted to <a href="/en-US/docs/Web/JavaScript/Data_structures#Boolean_type">boolean primitives</a>. To explicitly convert their return value (or any expression in general) to the corresponding boolean value, use a double <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT">NOT operator</a> or the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a> constructor.</p>
<h3 id="短路计算">短路计算</h3>
<p>由于逻辑表达式的运算的顺序是从左到右,也可以用以下规则进行"短路"计算：</p>
<ul>
<li><code>(some falsy expression) &amp;&amp; (<em>anything)</em></code> 短路计算的结果为假。</li>
<li><code>(some truthy expression) || <em>(anything)</em></code> 短路计算的结果为真。</li>
</ul>
<p>逻辑规则保证这些评估总是正确的。请注意，上述表达式中的 anything 部分未被评估，因此这样做的任何副作用都不会生效。还要注意，上述表达式的 anything 部分是任何单个逻辑表达式（如圆括号所示）。</p>
<p>例如，下面示例代码中的两个函数是相等的。</p>
<p>Short circuit means that the <em>expr</em> parts above are <strong>not evaluated</strong>, hence any side effects of doing so do not take effect (e.g., if <em>expr</em> is a function call, the calling never takes place). This happens because the value of the operator is already determined after the evaluation of the first operand. See example:</p>
<pre><code  class="language-javascript">function A(){ console.log('called A'); return false; }
function B(){ console.log('called B'); return true; }

console.log( A() &amp;&amp; B() );
// logs "called A" due to the function call,
// then logs false (which is the resulting value of the operator)

console.log( B() || A() );
// logs "called B" due to the function call,
// then logs true (which is the resulting value of the operator)
</code></pre>
<h3 id="Operators_precedence">Operators precedence</h3>
<p>请注意，由于<a href="Reference/Operators/Operator_Precedence">运算符优先级</a>的存在，下面的表达式的结果却不相同。右侧被小括号括起来的操作变成了独立的表达式。</p>
<pre><code  class="language-javascript">false &amp;&amp;  true || true      // 结果为 true
false &amp;&amp; (true || true)     // 结果为 false
</code></pre>
<h3 id="逻辑与（）">逻辑与（<code>&amp;&amp;</code>）</h3>
<p>下面的代码是 &amp;&amp; (逻辑与) 运算符的示例.</p>
<pre><code  class="language-javascript">a1 = true  &amp;&amp; true      // t &amp;&amp; t 返回 true
a2 = true  &amp;&amp; false     // t &amp;&amp; f 返回 false
a3 = false &amp;&amp; true      // f &amp;&amp; t 返回 false
a4 = false &amp;&amp; (3 == 4)  // f &amp;&amp; f 返回 false
a5 = "Cat" &amp;&amp; "Dog"     // t &amp;&amp; t 返回 "Dog"
a6 = false &amp;&amp; "Cat"     // f &amp;&amp; t 返回 false
a7 = "Cat" &amp;&amp; false     // t &amp;&amp; f 返回 false
a8 = ''    &amp;&amp; false     // f &amp;&amp; f 返回 ""
a9 = false &amp;&amp; ''        // f &amp;&amp; f 返回 false
</code></pre>
<h3 id="逻辑或（）">逻辑或（<code>||</code>）</h3>
<p>下面的代码是 || (逻辑或) 运算符的示例。</p>
<pre><code  class="language-javascript">o1 = true  || true      // t || t 返回 true
o2 = false || true      // f || t 返回 true
o3 = true  || false     // t || f 返回 true
o4 = false || (3 == 4)  // f || f 返回 false
o5 = "Cat" || "Dog"     // t || t 返回 "Cat"
o6 = false || "Cat"     // f || t 返回 "Cat"
o7 = "Cat" || false     // t || f 返回 "Cat"
o8 = ''    || false     // f || f 返回 false
o9 = false || ''        // f || f 返回 ""
</code></pre>
<h3 id="逻辑非（!）">逻辑非（<code>!</code>）</h3>
<p>下面的代码是 <code>!</code> (逻辑非) 运算符的示例.</p>
<pre><code  class="language-javascript">n1 = !true              // !t 返回 false
n2 = !false             // !f 返回 true
n3 = !''                // !f 返回 true
n4 = !'Cat'             // !t 返回 false
</code></pre>
<h4 id="双重非（!!）运算符">双重非（<code>!!</code>）运算符</h4>
<p>It is possible to use a couple of NOT operators in series to explicitly force the conversion of any value to the corresponding <a href="/en-US/docs/Web/JavaScript/Data_structures#Boolean_type">boolean primitive</a>. The conversion is based on the "truthyness" or "falsyness" of the value (see <a class="glossaryLink" href="/en-US/docs/Glossary/truthy" title='truthy: In JavaScript, a truthy value is a value that is considered  true when encountered in a Boolean context. All values are truthy unless they are defined as falsy (i.e., except for false, 0, "", null, undefined, and NaN).'>truthy</a> and <a class="glossaryLink" href="/en-US/docs/Glossary/falsy" title="falsy: A falsy value is a value that is considered false when encountered in a Boolean context.">falsy</a>).</p>
<p>The same conversion can be done through the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a> function.</p>
<pre><code class="language-js syntaxbox">n1 = !!true                   // !!truthy 返回 true
n2 = !!{}                     // !!truthy 返回 true: <strong>任何</strong> 对象都是 truthy 的…
n3 = !!(new Boolean(false))   // …甚至 <em>.valueOf()</em> 返回 false 的布尔值对象也是！
n4 = !!false                  // !!falsy 返回 false
n5 = !!""                     // !!falsy 返回 false
n6 = !!Boolean(false)         // !!falsy 返回 false
</code></pre>
<h3 id="布尔值转换规则">布尔值转换规则</h3>
<h4 id="将_AND_转换为_OR">将 AND 转换为 OR</h4>
<p>以下涉及<strong>布尔</strong>运算的操作：</p>
<pre><code  class="language-javascript">bCondition1 &amp;&amp; bCondition2</code></pre>
<p>总是等于：</p>
<pre><code  class="language-javascript">!(!bCondition1 || !bCondition2)</code></pre>
<h4 id="将_OR_转换为_AND">将 OR 转换为 AND</h4>
<p>以下涉及<strong>布尔</strong>运算的操作：</p>
<pre><code  class="language-javascript">bCondition1 || bCondition2</code></pre>
<p>总是等于：</p>
<pre><code  class="language-javascript">!(!bCondition1 &amp;&amp; !bCondition2)</code></pre>
<h3 id="删除嵌套的小括号">删除嵌套的小括号</h3>
<p>由于逻辑表达式是从左往右计算的，所以，通常可以按照下面的规则删除小括号。</p>
<h4 id="删除嵌套的_AND">删除嵌套的 AND</h4>
<p>以下涉及<strong>布尔</strong>运算的操作：</p>
<pre><code  class="language-javascript">bCondition1 || (bCondition2 &amp;&amp; bCondition3)</code></pre>
<p>总是等于：</p>
<pre><code  class="language-javascript">bCondition1 || bCondition2 &amp;&amp; bCondition3</code></pre>
<h4 id="删除嵌套的_OR">删除嵌套的 OR</h4>
<p>以下涉及<strong>布尔</strong>运算的操作：</p>
<pre><code  class="language-javascript">bCondition1 &amp;&amp; (bCondition2 || bCondition3)</code></pre>
<p>总是等于：</p>
<pre><code  class="language-javascript">!(!bCondition1 || !bCondition2 &amp;&amp; !bCondition3)</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">规范</th>
<th scope="col">状态</th>
<th scope="col">备注</th>
</tr>
<tr>
<td><a class="external" href="https://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%201st%20edition,%20June%201997.pdf" hreflang="en" lang="en" rel="noopener" title="ECMAScript 1st Edition (ECMA-262)">ECMAScript 1st Edition (ECMA-262)</a></td>
<td><span class="spec-Standard">Standard</span></td>
<td>Initial definition.</td>
</tr>
<tr>
<td><a class="external" href="https://www.ecma-international.org/ecma-262/5.1/#sec-11.11" hreflang="en" lang="en" rel="noopener" title="ECMAScript 5.1 (ECMA-262)">ECMAScript 5.1 (ECMA-262)</a></td>
<td><span class="spec-Standard">Standard</span></td>
<td>Defined in several sections of the specification: <a class="external" href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.4.9" rel="noopener">Logical NOT Operator</a>, <a class="external" href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.11" rel="noopener">Binary Logical Operators</a></td>
</tr>
<tr>
<td><a class="external" href="https://www.ecma-international.org/ecma-262/6.0/#sec-binary-logical-operators" hreflang="en" lang="en" rel="noopener" title="ECMAScript 2015 (6th Edition, ECMA-262)">ECMAScript 2015 (6th Edition, ECMA-262)</a></td>
<td><span class="spec-Standard">Standard</span></td>
<td>Defined in several sections of the specification: <a class="external" href="http://www.ecma-international.org/ecma-262/6.0/#sec-logical-not-operator" rel="noopener">Logical NOT Operator</a>, <a class="external" href="http://www.ecma-international.org/ecma-262/6.0/#sec-binary-logical-operators" rel="noopener">Binary Logical Operators</a></td>
</tr>
<tr>
<td><a class="external" href="https://tc39.github.io/ecma262/#sec-binary-logical-operators" hreflang="en" lang="en" rel="noopener" title="ECMAScript Latest Draft (ECMA-262)">ECMAScript Latest Draft (ECMA-262)</a></td>
<td><span class="spec-Draft">Draft</span></td>
<td>Defined in several sections of the specification: <a class="external" href="http://tc39.github.io/ecma262/#sec-logical-not-operator" rel="noopener">Logical NOT Operator</a>, <a class="external" href="http://tc39.github.io/ecma262/#sec-binary-logical-operators" rel="noopener">Binary Logical Operators</a></td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<div class="hidden">The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div>
<p></p><div class="bc-data"><a class="bc-github-link external" href="https://github.com/mdn/browser-compat-data" rel="noopener">Update compatibility data on GitHub</a><table class="bc-table bc-table-js"><thead><tr class="bc-platforms"><td></td><th class="bc-platform-desktop" colspan="6"><span>Desktop</span></th><th class="bc-platform-mobile" colspan="7"><span>Mobile</span></th><th class="bc-platform-server" colspan="1"><span>Server</span></th></tr><tr class="bc-browsers"><td></td><th class="bc-browser-chrome"><span class="bc-head-txt-label bc-head-icon-chrome">Chrome</span></th><th class="bc-browser-edge"><span class="bc-head-txt-label bc-head-icon-edge">Edge</span></th><th class="bc-browser-firefox"><span class="bc-head-txt-label bc-head-icon-firefox">Firefox</span></th><th class="bc-browser-ie"><span class="bc-head-txt-label bc-head-icon-ie">Internet Explorer</span></th><th class="bc-browser-opera"><span class="bc-head-txt-label bc-head-icon-opera">Opera</span></th><th class="bc-browser-safari"><span class="bc-head-txt-label bc-head-icon-safari">Safari</span></th><th class="bc-browser-webview_android"><span class="bc-head-txt-label bc-head-icon-webview_android">Android webview</span></th><th class="bc-browser-chrome_android"><span class="bc-head-txt-label bc-head-icon-chrome_android">Chrome for Android</span></th><th class="bc-browser-edge_mobile"><span class="bc-head-txt-label bc-head-icon-edge_mobile">Edge Mobile</span></th><th class="bc-browser-firefox_android"><span class="bc-head-txt-label bc-head-icon-firefox_android">Firefox for Android</span></th><th class="bc-browser-opera_android"><span class="bc-head-txt-label bc-head-icon-opera_android">Opera for Android</span></th><th class="bc-browser-safari_ios"><span class="bc-head-txt-label bc-head-icon-safari_ios">Safari on iOS</span></th><th class="bc-browser-samsunginternet_android"><span class="bc-head-txt-label bc-head-icon-samsunginternet_android">Samsung Internet</span></th><th class="bc-browser-nodejs"><span class="bc-head-txt-label bc-head-icon-nodejs">Node.js</span></th></tr></thead><tbody><tr><th scope="row"><a href="#Logical_AND">Logical AND (<code>&amp;&amp;</code>)</a></th><td class="bc-supports-yes bc-browser-chrome"><span class="bc-browser-name">Chrome</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-edge"><span class="bc-browser-name">Edge</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-firefox"><span class="bc-browser-name">Firefox</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              1</td><td class="bc-supports-yes bc-browser-ie"><span class="bc-browser-name">IE</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-opera"><span class="bc-browser-name">Opera</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-safari"><span class="bc-browser-name">Safari</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-webview_android"><span class="bc-browser-name">WebView Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-chrome_android"><span class="bc-browser-name">Chrome Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-edge_mobile"><span class="bc-browser-name">Edge Mobile</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-firefox_android"><span class="bc-browser-name">Firefox Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              4</td><td class="bc-supports-yes bc-browser-opera_android"><span class="bc-browser-name">Opera Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-safari_ios"><span class="bc-browser-name">Safari iOS</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-samsunginternet_android"><span class="bc-browser-name">Samsung Internet Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-nodejs"><span class="bc-browser-name">nodejs</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td></tr><tr><th scope="row"><a href="#Logical_OR">Logical OR (<code>||</code>)</a></th><td class="bc-supports-yes bc-browser-chrome"><span class="bc-browser-name">Chrome</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-edge"><span class="bc-browser-name">Edge</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-firefox"><span class="bc-browser-name">Firefox</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              1</td><td class="bc-supports-yes bc-browser-ie"><span class="bc-browser-name">IE</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-opera"><span class="bc-browser-name">Opera</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-safari"><span class="bc-browser-name">Safari</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-webview_android"><span class="bc-browser-name">WebView Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-chrome_android"><span class="bc-browser-name">Chrome Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-edge_mobile"><span class="bc-browser-name">Edge Mobile</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-firefox_android"><span class="bc-browser-name">Firefox Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              4</td><td class="bc-supports-yes bc-browser-opera_android"><span class="bc-browser-name">Opera Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-safari_ios"><span class="bc-browser-name">Safari iOS</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-samsunginternet_android"><span class="bc-browser-name">Samsung Internet Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-nodejs"><span class="bc-browser-name">nodejs</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td></tr><tr><th scope="row"><a href="#Logical_NOT">Logical NOT (<code>!</code>)</a></th><td class="bc-supports-yes bc-browser-chrome"><span class="bc-browser-name">Chrome</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-edge"><span class="bc-browser-name">Edge</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-firefox"><span class="bc-browser-name">Firefox</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              1</td><td class="bc-supports-yes bc-browser-ie"><span class="bc-browser-name">IE</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-opera"><span class="bc-browser-name">Opera</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-safari"><span class="bc-browser-name">Safari</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-webview_android"><span class="bc-browser-name">WebView Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-chrome_android"><span class="bc-browser-name">Chrome Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-edge_mobile"><span class="bc-browser-name">Edge Mobile</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-firefox_android"><span class="bc-browser-name">Firefox Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              4</td><td class="bc-supports-yes bc-browser-opera_android"><span class="bc-browser-name">Opera Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-safari_ios"><span class="bc-browser-name">Safari iOS</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-samsunginternet_android"><span class="bc-browser-name">Samsung Internet Android</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td><td class="bc-supports-yes bc-browser-nodejs"><span class="bc-browser-name">nodejs</span><abbr class="bc-level-yes only-icon" title="Full support">
<span>Full support</span>
</abbr>
              Yes</td></tr></tbody></table><section class="bc-legend" id="sect1"><h3 class="offscreen" id="Legend">Legend</h3><dl><dt><span class="bc-supports-yes bc-supports">
<abbr class="bc-level bc-level-yes only-icon" title="Full support">
<span>Full support</span>
                  
                </abbr></span></dt><dd>Full support</dd></dl></section></div><p></p>
<h2 id="参见">参见</h2>
<ul>
<li><a href="Reference/Operators/Bitwise_Operators">按位操作符</a></li>
<li><a href="Reference/Global_Objects/Boolean">布尔值</a></li>
<li><a href="/zh-CN/docs/Glossary/Truthy">Truthy</a></li>
<li><a href="/zh-CN/docs/Glossary/Falsy">Falsy</a></li>
</ul>
</article>